package Application.client;

import Application.entity.Customer;
import Application.factory.SearchClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "SEARCH",
//        fallback = SearchClientFallBack.class
        fallbackFactory = SearchClientFallBackFactory.class
)  //指定服务名称
public interface SearchClient {
    //value 目标服务器的请求路径
    @RequestMapping(value ="/search",method = RequestMethod.GET)
    String search();

    @RequestMapping(value = "/search/{id}",method = RequestMethod.GET)
    Customer searchById(@PathVariable(value = "id") Integer id);

    @RequestMapping(value = "/getCustomer",method = RequestMethod.GET)
    Customer getCustomer(@RequestParam(value = "id") Integer id,@RequestParam(value = "name") String name);

    @RequestMapping(value = "/save",method = RequestMethod.POST)
    Customer save(@RequestBody Customer customer);
}
